<template>
  <div>
    <el-dialog title="工单详情" :visible="$store.state.dialog.XqDialog" :before-close="handleClose">
      <el-row>
        <h4>{{ type }}</h4>
      </el-row>
      <el-row>
        <el-col :span="12">设备编号：{{ row.innerCode }}</el-col>
        <el-col :span="12">创建日期：{{ row.createTime }}</el-col>
      </el-row>
      <el-row>
        <el-col :span="12">取消日期：{{ row.updateTime }}</el-col>
        <el-col :span="12">运行人员：{{ row.userName }}</el-col>
      </el-row>
      <el-row>
        <el-col :span="12">工单类型：{{ row.taskType }}</el-col>
        <el-col :span="12">
          补货数量：
          <a href="#" @click="ment">补货详情</a>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">工单方式：{{ row.createType }}</el-col>
        <el-col :span="12">取消原因：{{ row.desc }}</el-col>
      </el-row>
      <div slot="footer" v-if="$store.state.dialog.row.taskStatus === '取消'" class="dialog-footer">
        <el-button type="primary" @click="cxCj">重新创建</el-button>
      </div>
      <div slot="footer" v-else-if="$store.state.dialog.row.taskStatus === '待办'" class="dialog-footer">
        <el-button type="primary" @click="XqFn">取消工单</el-button>
      </div>
      <div slot="footer" v-else-if="$store.state.dialog.row.taskStatus === '进行'" class="dialog-footer">
        <el-button type="primary" @click="PaddingFn">进行</el-button>
      </div>
      <div v-else></div>
    </el-dialog>
    <addDialog :row="$store.state.dialog.row"></addDialog>
    <BhDialog>
    </BhDialog>
  </div>
</template>

<script>
import { getMent } from '@/api/oder'
export default {
  name: 'XqDialog',
  props: {
    row: {
      typeof: 'Object',
      default: () => ({}),
    },
  },
  data() {
    return {}
  },
  components: {},
  methods: {
    handleClose() {
      this.$store.commit('dialog/updateXqDialog', false)
      this.$store.commit('dialog/updateRow', {})
      this.$store.commit('dialog/updateXqList', [])
      this.$store.commit('dialog/perpoe', [])
    },
    // 创建
    cxCj() {
      this.$store.commit('dialog/updateAddDialog', true)
    },
    // 补货清单
    async ment() {
      this.$store.commit('dialog/updateBhDialog', true)
      console.log(22222)
      const res = await getMent(this.$store.state.dialog.row.taskId)
      this.xqList = res
      this.$store.commit('dialog/updateXqList', res)
    },
    // 取消
    XqFn(){
      console.log(1);
      this.$store.commit('dialog/updateXqDialog', false)
    }
  },
  computed: {
    type(){
      if(this.$store.state.dialog.row.taskStatus === '取消' ) {
        return '取消'
      } else if(this.$store.state.dialog.row.taskStatus === '待办'){
        return '待办'
      } else if(this.$store.state.dialog.row.taskStatus === '完成' ) {
        return '完成'
      } else {
        return '进行'
      }
    }
  },
  mounted() {},
  watch: {},
}
</script>

<style scoped lang="scss">
</style>
